package com.baizhi.entity;

import com.baizhi.interfaces.AddGroup;
import com.baizhi.interfaces.UpdateGroup;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 商品三级分类; InnoDB free: 13312 kB
 * </p>
 *
 * @author lby
 * @since 2020-12-22
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class PmsCategory implements Serializable {

    /**
     * 分类id
     *
     * 添加方法 id不能有值
     * 修改方法 id不能为null
     */
    @Null(groups = AddGroup.class)
    @NotNull(groups = UpdateGroup.class)
    @TableId(value = "cat_id", type = IdType.AUTO)
    private Long catId;

    /**
     * 分类名称
     */
    @NotEmpty(groups = {AddGroup.class,UpdateGroup.class})
    private String name;

    @Email(groups = {AddGroup.class,UpdateGroup.class})
    @TableField(exist = false)
    private String email;
    /**
     * 层级
     */
    @NotNull(groups = {AddGroup.class,UpdateGroup.class})
    private Integer catLevel;

    /**
     * 是否显示[0-不显示，1显示]
     */
    @NotNull
    private Integer showStatus;


    /**
     * 父分类id
     */
    private Long parentCid;

    /**
     * 排序
     */
    private Integer sort;

    /**
     * 图标地址
     */
    private String icon;

    /**
     * 计量单位
     */
    private String productUnit;

    /**
     * 商品数量
     */
    private Integer productCount;

    @TableField(exist = false)
    private List<PmsCategory> categoryList;
}
